package cn.wusifx.zabbix.request.builder.correlation;

import cn.wusifx.zabbix.request.BaseRequest;
import cn.wusifx.zabbix.request.builder.UpdateRequestBuilder;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * https://www.zabbix.com/documentation/4.0/manual/api/reference/correlation/update
 */
public class CorrelationUpdateRequestBuilder extends UpdateRequestBuilder {
    private List<String> correlationIds = new ArrayList<>();
    public CorrelationUpdateRequestBuilder(String auth) {
        super("correlation.update", auth);
    }

    public CorrelationUpdateRequestBuilder(Long id, String auth) {
        super("correlation.update", id, auth);
    }

    public List<String> getCorrelationIds() {
        return correlationIds;
    }

    public CorrelationUpdateRequestBuilder setCorrelationIds(List<String> correlationIds) {
        this.correlationIds = correlationIds;
        return this;
    }

    public CorrelationUpdateRequestBuilder addCorrelationId(String correlationId) {
        this.correlationIds.add(correlationId);
        return this;
    }

    @Override
    public BaseRequest<Map<String, Object>> builder() {
        baseRequest.getParams().put("correlationid",correlationIds);
        return baseRequest;
    }
}
